package ttestClosed;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.InetAddress;
import java.net.MulticastSocket;

public class TestSend {

    /**
     * @param args
     */
    public static void main(String[] args) {
        int port = 5555; // Port to send to
        String mcastGroup = "225.4.5.6"; // Multicast address
        // Create a socket
        MulticastSocket s;
        try {
            s = new MulticastSocket();
            // We are only sending data and not receiving,
            // so we don't have to join the multicast group
            String hi = "Hello!";
            // Create a DatagramPacket
            DatagramPacket packet = new DatagramPacket(hi.getBytes(),
                    hi.length(), InetAddress.getByName(mcastGroup), port);
            s.send(packet); // Send the packet
            s.close(); // Close the socekt when finished
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}
